<template>
  <el-container style="min-height: 100vh">
    <el-aside :width="sideWidth + 'px'" style="background-color: rgb(238, 241, 246);">
<!--      侧边栏组件-->
      <Aside :isCollapse="isCollapse"/>
    </el-aside>

    <el-container>

      <el-header style="border-bottom: 1px solid #ccc">
<!--        头部组件-->
        <Header :collapseBtnClass="collapseBtnClass" @asideCollapse="collapse" />
      </el-header>

      <el-main>
<!--        表示当前页面的子路由会在router-view里展示-->
        <router-view />
      </el-main>

    </el-container>
  </el-container>
</template>


<script>


import Aside from "@/components/Aside";
import Header from "@/components/Header";

export default {
  name: 'Home',
  data() {

    return{
      collapseBtnClass: 'el-icon-s-fold',
      isCollapse: false,
      sideWidth: 200
    }
  },
  components: {
    Aside,
    Header
  },
  methods: {
    collapse() {
      this.isCollapse = !this.isCollapse;
      if(this.isCollapse) {
        this.sideWidth = 64;
        this.collapseBtnClass = 'el-icon-s-unfold';
      }else {
        this.sideWidth = 200;
        this.collapseBtnClass = 'el-icon-s-fold';
      }
    }
  }
}
</script>
